home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 7
/
Aminet 7 - August 1995.iso
/
Aminet
/
comm
/
net
/
netutils.lha
/
NetUtilities
/
source
/
send.c
< prev
Wrap
C/C++ Source or Header
|
1993-04-05
|
850b
|
50 lines
#include <stdio.h>
#include <libraries/dos.h>
#define SND_PKT "net:ram/receive.pkt"
#define INF_PKT "net:ram/inform.pkt"
#define SND_ERR "Couldn't open send packet\n"
struct FileHandle *out=0;
void quit(void) {
Close(out);
exit(0);
}
void main(void) {
char buf[256];
FILE *outfile=0;
short err=0, i;
out = (struct FileHandle *)Open("CON:0/100/600/100/Parnet chat send",MODE_NEWFILE);
if (!out) quit();
if (outfile = fopen(INF_PKT, "w")) fclose(outfile);
onbreak(quit);
for(;;) {
chkabort();
for (i=0;i<256;i++) buf[i]=0;
Read(out,buf,256);
chkabort();
err=0;
if (access(SND_PKT, 0) != 0) {
outfile=0;
if (outfile = fopen(SND_PKT, "w")) {
fputs(buf, outfile);
fclose(outfile);
} else err=1;
};
if (err==1) Write(out, SND_ERR, strlen(SND_ERR));
}
}